<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui">

    <h:form id="XImagenListForm">

        <p:panel header="#{seriesBundle.ListXImagenTitle}">
            <p:contextMenu id="XImagenDataTableContextMenu" for="datalist">  
                <p:menuitem value="#{seriesBundle.Create}" onclick="document.getElementById('XImagenListForm:createButton').click();" icon="ui-icon-plus"/>
                <p:menuitem value="#{seriesBundle.View}" onclick="document.getElementById('XImagenListForm:viewButton').click();" icon="ui-icon-search"/>
                <p:menuitem value="#{seriesBundle.Edit}" onclick="document.getElementById('XImagenListForm:editButton').click();" icon="ui-icon-pencil"/>
                <p:menuitem value="#{seriesBundle.Delete}" onclick="document.getElementById('XImagenListForm:deleteButton').click();" icon="ui-icon-trash"/>
                <p:separator/>
                <p:menuitem value="#{seriesBundle.XImagenMenuItem_colaboradorCollection}" icon="ui-icon-search"  action="#{xImagenController.navigateColaboradorCollection}" disabled="#{empty xImagenController.selected.colaboradorCollection}" ajax="false"/>  
                <p:menuitem value="#{seriesBundle.XImagenMenuItem_emisoraCollection}" icon="ui-icon-search"  action="#{xImagenController.navigateEmisoraCollection}" disabled="#{empty xImagenController.selected.emisoraCollection}" ajax="false"/>  
                <p:menuitem value="#{seriesBundle.XImagenMenuItem_idCarpeta}" icon="ui-icon-search"  actionListener="#{xImagenController.prepareIdCarpeta}" update=":XCarpetaViewForm" oncomplete="PF('XCarpetaViewDialog').show()" disabled="#{empty xImagenController.selected.idCarpeta}"/>  
                <p:menuitem value="#{seriesBundle.XImagenMenuItem_webCollection}" icon="ui-icon-search"  action="#{xImagenController.navigateWebCollection}" disabled="#{empty xImagenController.selected.webCollection}" ajax="false"/>  
                <p:menuitem value="#{seriesBundle.XImagenMenuItem_serieCollection}" icon="ui-icon-search"  action="#{xImagenController.navigateSerieCollection}" disabled="#{empty xImagenController.selected.serieCollection}" ajax="false"/>  
                <p:menuitem value="#{seriesBundle.XImagenMenuItem_serieCollection1}" icon="ui-icon-search"  action="#{xImagenController.navigateSerieCollection1}" disabled="#{empty xImagenController.selected.serieCollection1}" ajax="false"/>  
                <p:menuitem value="#{seriesBundle.XImagenMenuItem_serieCollection2}" icon="ui-icon-search"  action="#{xImagenController.navigateSerieCollection2}" disabled="#{empty xImagenController.selected.serieCollection2}" ajax="false"/>  
                <p:menuitem value="#{seriesBundle.XImagenMenuItem_serieCollection3}" icon="ui-icon-search"  action="#{xImagenController.navigateSerieCollection3}" disabled="#{empty xImagenController.selected.serieCollection3}" ajax="false"/>  
                <p:menuitem value="#{seriesBundle.XImagenMenuItem_televisoraCollection}" icon="ui-icon-search"  action="#{xImagenController.navigateTelevisoraCollection}" disabled="#{empty xImagenController.selected.televisoraCollection}" ajax="false"/>  
            </p:contextMenu>
            <p:dataTable id="datalist"
                         value="#{xImagenController.items}"
                         var="item"
                         rowKey="#{item.idImagen}"
                         paginator="true"
                         rows="25"
                         rowsPerPageTemplate="10,25,50,100"
                         selectionMode="single"
                         selection="#{xImagenController.selected}">

                <p:ajax event="rowSelect"   update=":XImagenListForm:createButton :XImagenListForm:viewButton :XImagenListForm:editButton :XImagenListForm:deleteButton :XImagenListForm:XImagenDataTableContextMenu" listener="#{xImagenController.resetParents}"/>
                <p:ajax event="rowUnselect" update=":XImagenListForm:createButton :XImagenListForm:viewButton :XImagenListForm:editButton :XImagenListForm:deleteButton :XImagenListForm:XImagenDataTableContextMenu" listener="#{xImagenController.resetParents}"/>
                <p:ajax event="rowDblselect" onsuccess="document.getElementById('XImagenListForm:viewButton').click();"/>

                <p:column sortBy="#{item.idImagen}" filterBy="#{item.idImagen}">
                    <f:facet name="header">
                        <h:outputText value="#{seriesBundle.ListXImagenTitle_idImagen}"/>
                    </f:facet>
                    <h:outputText value="#{item.idImagen}"/>
                </p:column>


                <p:column sortBy="#{item.nombre}" filterBy="#{item.nombre}">
                    <f:facet name="header">
                        <h:outputText value="#{seriesBundle.ListXImagenTitle_nombre}"/>
                    </f:facet>
                    <h:outputText value="#{item.nombre}"/>
                </p:column>


                <p:column sortBy="#{item.tipo}" filterBy="#{item.tipo}">
                    <f:facet name="header">
                        <h:outputText value="#{seriesBundle.ListXImagenTitle_tipo}"/>
                    </f:facet>
                    <h:outputText value="#{item.tipo}"/>
                </p:column>


                <p:column sortBy="#{item.fechaSubida}" filterBy="#{item.fechaSubida}">
                    <f:facet name="header">
                        <h:outputText value="#{seriesBundle.ListXImagenTitle_fechaSubida}"/>
                    </f:facet>
                    <h:outputText value="#{item.fechaSubida}">
                        <f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
                    </h:outputText>
                </p:column>


                <p:column sortBy="#{item.descripcion}" filterBy="#{item.descripcion}">
                    <f:facet name="header">
                        <h:outputText value="#{seriesBundle.ListXImagenTitle_descripcion}"/>
                    </f:facet>
                    <h:outputText value="#{item.descripcion}"/>
                </p:column>


                <p:column sortBy="#{item.idCarpeta.descripcion}" filterBy="#{item.idCarpeta.descripcion}">
                    <f:facet name="header">
                        <h:outputText value="#{seriesBundle.ListXImagenTitle_idCarpeta}"/>
                    </f:facet>
                    <h:outputText value="#{item.idCarpeta.descripcion}"/>
                </p:column>


            </p:dataTable>

            <p:commandButton id="createButton"                             icon="ui-icon-plus"   value="#{seriesBundle.Create}" actionListener="#{xImagenController.prepareCreate}" update=":XImagenCreateForm" oncomplete="PF('XImagenCreateDialog').show()"/>
            <p:commandButton id="viewButton"   style="visibility: hidden;" icon="ui-icon-search" value="#{seriesBundle.View}" update=":XImagenViewForm" oncomplete="PF('XImagenViewDialog').show()" disabled="#{empty xImagenController.selected}"/>
            <p:commandButton id="editButton"   style="visibility: hidden;" icon="ui-icon-pencil" value="#{seriesBundle.Edit}" update=":XImagenEditForm" oncomplete="PF('XImagenEditDialog').show()" disabled="#{empty xImagenController.selected}"/>
            <p:commandButton id="deleteButton" style="visibility: hidden;" icon="ui-icon-trash"  value="#{seriesBundle.Delete}" actionListener="#{xImagenController.delete}" update=":growl,datalist" disabled="#{empty xImagenController.selected}">
                <p:confirm header="#{seriesBundle.ConfirmationHeader}" message="#{seriesBundle.ConfirmDeleteMessage}" icon="ui-icon-alert"/>
            </p:commandButton>

        </p:panel>
        <ui:include src="/WEB-INF/generic/confirmation.xhtml"/>
    </h:form>

</ui:composition>